/**
 * Created by Toma on 2016/11/21.
 * 散点图
 */

var H5ComponentBar = function (name, cfg) {
  var compontent = new H5ComonentBase(name, cfg);

  $.each(cfg.data, function (idx, item) {
    var line = $('<div class="line">');
    var name = $('<div class="name">');
    var rate = $('<div class="rate">');
    var per = $('<div class="per">');
    var bg = $('<div class="bg">');

    var width = item[1]*100 + '%';
    rate.width(width);
    rate.append(bg)
    item[2] && bg.css({'background-color': item[2]});

    per.text(width);
    name.text(item[0]);
    line.append(name).append(rate).append(per);

    compontent.append(line);
  });

  return compontent;
};